#include "StdAfx.h"
#include "FCThreadHelper.h"

namespace fclib {
    namespace fcthread {

HANDLE fcFancyCreateThread(LPTHREAD_START_ROUTINE lpStartAddr, 
            LPVOID lpParameter, bool bSuspend)
{
    return (HANDLE)_beginthreadex(NULL, 0, (PTHREAD_START)lpStartAddr, lpParameter,
        bSuspend ? (CREATE_SUSPENDED):(0), NULL);
}

void fcWaitAndCloseThread(HANDLE& hThread)
{
    WaitForSingleObject(hThread, INFINITE);
    ::CloseHandle(hThread);
    hThread = NULL;
}

    }
}
